package com.example.admin.controller;

import com.example.admin.client.MerchantClient;
import com.example.common.BaseContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("admin")
public class AdminController {
    // http -> java

    /*
    1-要在Client上面加@FeignClient
    2-启动类上面要加@EnableFeignClients
    加完merchantClient就不会爆红了
     */
    @Autowired
    private MerchantClient merchantClient;
    @GetMapping("index")
    public void index(){
        log.info("adminController被调用");
        BaseContext.setContext("1234");
        String name = Thread.currentThread().getName();
        log.info("admin的线程名称：{}",name);
        merchantClient.index();
    }
}
